/**
 * gislin 2017年9月19日
 */
package com.btcode.orm.model.generater;

import com.btcode.db.fieldtype.FieldType;
import com.btcode.orm.model.BaseModel;
import com.btcode.orm.model.Field;
import com.btcode.orm.model.IField;

/**
 * @author gislin 2017年9月19日
 */
@SuppressWarnings("unchecked")
public class TableInfoModel extends BaseModel {

    /**
     *
     */
    private static final long serialVersionUID = 1L;


    public final static IField columnName = new Field(TableInfoModel.class, "COLUMN_NAME",
                                                FieldType.String);

    public final static IField dataType = new Field(TableInfoModel.class, "DATA_TYPE", FieldType.String);

    public final static IField isKey = new Field(TableInfoModel.class, "IS_KEY", FieldType.String);

    public final static IField isUnique = new Field(TableInfoModel.class, "IS_UNIQUE", FieldType.String);

    public void setColumnName(String columnName) {
        put(TableInfoModel.columnName.getFieldName(), columnName);
    }

    public void setDataType(String dataType) {
        put(TableInfoModel.dataType.getFieldName(), dataType);
    }

    public void setIsKey(String isKey) {
        put(TableInfoModel.isKey.getFieldName(), isKey);
    }

    public void setIsUnique(String isUnique) {
        put(TableInfoModel.isUnique.getFieldName(), isUnique);
    }

    public String getColumnName() {
        Object value = get(TableInfoModel.columnName.getFieldName());
        String result = getValueConver().converToString(value);
        return result;
    }

    public String getDataType() {
        Object value = get(TableInfoModel.dataType.getFieldName());
        String result = getValueConver().converToString(value);
        return result;
    }

    public String getIsKey() {
        Object value = get(TableInfoModel.isKey.getFieldName());
        String result = getValueConver().converToString(value);
        return result;
    }

    public String getIsUnique() {
        Object value = get(TableInfoModel.isUnique.getFieldName());
        String result = getValueConver().converToString(value);
        return result;
    }

    /* (non-Javadoc)
     * @see com.bandit.orm.model.IModel#getTableName()
     */
    @Override
    public String getTableName() {
        return null;
    }

    /* (non-Javadoc)
     * @see com.bandit.orm.model.IModel#isNeedCache()
     */
    @Override
    public boolean isNeedCache() {
        return false;
    }

}
